import 'package:syn_4s/core/model/alert_model.dart';
import 'package:syn_4s/core/model/asset_model.dart';
import 'package:syn_4s/core/model/helmet_model.dart';
import 'package:syn_4s/core/model/lock_model.dart';
import 'package:syn_4s/core/model/permit_to_work_model.dart';
import 'package:syn_4s/core/model/safety_training_model.dart';
import 'package:syn_4s/core/model/un_safe_act_model.dart';
import 'package:syn_4s/core/model/watch_model.dart';
import 'package:syn_4s/core/model/weather_model.dart';

import 'gas_model.dart';

class MainModel{
  List<Dwss>? dwss;
  List<GasMonitoring>? envtal;
  List<Vr>? vr;
  List<Watch>? watch;
  List<Weather>? weather;
  List<LockModel>? eleclock;
  AssetModel? asset;
  HelmetModel? helmet;
  List<UnSafeActModel>? aIConstSite;

  MainModel({this.dwss,this.envtal,this.vr,this.watch,this.weather,this.eleclock,this.asset,this.helmet,this.aIConstSite});

  MainModel.fromJson(Map<String, dynamic> json) {
    if (json['dwss'] != null) {
      dwss = <Dwss>[];
      json['dwss'].forEach((v) {
        dwss!.add(new Dwss.fromJson(v));
      });
    }
    if (json['envtal'] != null) {
      envtal = <GasMonitoring>[];
      json['envtal'].forEach((v) {
        envtal!.add(new GasMonitoring.fromJson(v));
      });
    }
    if (json['watch'] != null) {
      watch = <Watch>[];
      json['watch'].forEach((v) {
        watch!.add(new Watch.fromJson(v));
      });
    }
    if (json['vr'] != null) {
      vr = <Vr>[];
      json['vr'].forEach((v) {
        vr!.add(new Vr.fromJson(v));
      });
    }
    if (json['weather'] != null) {
      weather = <Weather>[];
      json['weather'].forEach((v) {
        weather!.add(new Weather.fromJson(v));
      });
    }
    if (json['eleclock'] != null) {
      eleclock = <LockModel>[];
      json['eleclock'].forEach((v) {
        eleclock!.add(new LockModel.fromJson(v));
      });
    }
    asset = json['asset'] != null ? AssetModel.fromJson(json['asset']) : null;
    helmet =
    json['helmet'] != null ? HelmetModel.fromJson(json['helmet']) : null;
    if (json['aIConstSite'] != null) {
      aIConstSite = <UnSafeActModel>[];
      json['aIConstSite'].forEach((v) {
        aIConstSite!.add(new UnSafeActModel.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.watch != null) {
      data['watch'] = this.watch!.map((v) => v.toJson()).toList();
    }
    if (this.dwss != null) {
      data['dwss'] = this.dwss!.map((v) => v.toJson()).toList();
    }
    if (this.envtal != null) {
      data['envtal'] = this.envtal!.map((v) => v.toJson()).toList();
    }
    if (this.vr != null) {
      data['vr'] = this.vr!.map((v) => v.toJson()).toList();
    }
    if (this.weather != null) {
      data['weather'] = this.weather!.map((v) => v.toJson()).toList();
    }
    if (this.eleclock != null) {
      data['eleclock'] = this.eleclock!.map((v) => v.toJson()).toList();
    }
    if (this.asset != null) {
      data['asset'] = this.asset!.toJson();
    }
    if (this.helmet != null) {
      data['helmet'] = this.helmet!.toJson();
    }
    if (this.aIConstSite != null) {
      data['aIConstSite'] = this.aIConstSite!.map((v) => v.toJson()).toList();
    }
    return data;
  }

}